<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form action="http://localhost:3000/code" method="post">
        <input type="text" name="username"><br>
        <input type="text" name="password"><br>
        <img src="http://localhost:3000/code?id=111" alt=""><br>
        请输入验证码：<input type="text"><br>
        <button>注册</button>
    </form>
    <script>
        //获取图片
        let img = document.querySelector('img');
        img.addEventListener('click', function () {
            let s = new Date().getTime();
            this.src = `http://localhost:3000/code?id=${s}`
        })
    </script>
</body>

</html>